-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print unhandled exception to stdout depending on verbosity #374
Conversation
Thank you @cblp ! |
Web/Scotty/Action.hs
Outdated
Handler $ \(E.SomeException e) -> do | ||
when (verbose > 0) $ | ||
liftIO $ | ||
putStrLn $ "Caught and exception of " <> show (typeOf e) <> ": " <> show e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional that it goes to stdout, not stderr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://12factor.net/logs recommend stdout, but I'm not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion; I think stdout is fine too. By the way Caught and exception of
looks like a typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 👍
@@ -1,6 +1,7 @@ | |||
{-# LANGUAGE OverloadedStrings #-} | |||
{-# LANGUAGE OverloadedStrings #-} | |||
{-# LANGUAGE CPP #-} | |||
{-# LANGUAGE NamedFieldPuns #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows to read record fields in the most natural way (in my taste):
-- line 179
someExceptionHandler Options{verbose} =
when (verbose > 0) ...
Hi @cblp , there are some small conflicts due to a PR I recently merged. Happy to merge your changes once they are fixed. Thanks again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a CHANGELOG entry as well?
Thanks! |
Improved docs for `verbose` parameter of the `Options` type. This documents the changes from scotty-web#374 here as well.
No description provided.